<!DOCTYPE html>
<html>
<head lang="zh-CN">
    <meta charset="UTF-8">
    <meta name="viewport" content=" initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>分享内容</title>
    <link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="{$Think.config.RESOURCEURL}wx_assets/quan/materia.css{$Think.config.RESOURCE_VER}" />
    <script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
</head>
<body>
     <div class="content-box" id="contentBox">
       
    </div>
</body>
<script type="text/html" id="contentTpl">
  <%if(list && list.length>0){
	for(var i=0;i<list.length;i++){
		var item=list[i];
    %>
 <div class="contentlist">
        <dl>
            <dt class="title">
					<%=dateFormat(item.miniday,"M月dd日")%>	   			
			</dt>

		<%if(item.list){%>
		<dd>
			<ul>
					<%
                   		for(var j=0;j<item.list.length;j++){
						var item1=item.list[j];
                 	%>
					
	            		 <li>
							<a onclick="contentList.toDetail('<%=item1.id%>')">
 							<div class="imgDiv" align="center">
                                <img src="<%=item1.picUrl%>"></div>
                            <%if(item1.title){%>
                                <div class="commonDiv">
                                    <div class="common">
                                        <%=item1.title%></div>
                                </div>
                            <%}%>						
							</a>
                            <%if(item1.recomment){%>
							<i></i>
                        	<div class="psDiv">
                          	  <div class="ps">
                            	  <%=item1.recomment%></div>
                       		 </div>
                             <%}%>					
						 </li>				    
					<%}%>
	        </ul>
</dd>
    	<%}%>
 </dl>
	<%}%>
</div>
  <%} else {%>
    <div class="norecord">暂无相关内容</div>
<%}%>
</script>
<script type="text/javascript">
    var baseUrl = '{$Think.config.SERVER_HOST}';
    var contentList={
        pageSize:10,
        page:0,
        init:function(){
            var me=this;
            this._initEvent();
            $.util.pageLoading.show();
            me._loadList(me.page,function(){
                $.util.pageLoading.hide();
            });
        },
        toDetail:function(id){
            var p=$.util.getParamAsObject();
            var params={
                "id":id,
                "qId":"{$qId}"
            }
            params=encodeURIComponent(JSON.stringify(params));
            location.href= 'call.html?customerId={$customerId}&module=quan&method=getMiContentDetail&params='+params;
        },
        _initEvent:function(){
            var me=this;
            $.util.initDataLoading({
                me:contentList,
                lastChildren:function(){
                    return $("#contentBox .contentlist:last");
                },
                page:function(){
                    return contentList.page; 
                },
                pageCount:function(){
                    return contentList.pageCount;
                }
            });
        },
        _renderList:function(data,page,callback){
            var me=this;
           if(data){
                var html=template("contentTpl", data),
                    container=$("#contentBox");
                container.append(html);
                me.page=page;
                me.pageCount=data.pageCount;
                callback && callback();
           }   
        },
        _loadList:function(page,callback){
            var me=this;
            $.req.get("call.json?module=quan&customerId={$customerId}&method=getMiContentList",{
                userName:"{$userName}",
                params:{
                	"qId":"{$qId}",
                    "start":page,
                    "limit":me.pageSize
                }
            },function(data){
                if(data){
                    me._renderList(data,page,callback);
                }
            });
        }
    }
    contentList.init();
    wx_share.init({
        "pkg":{
            "appId": '{$pkg.appId}',
            "timestamp": {$pkg.timestamp},
            "nonceStr": '{$pkg.nonceStr}',
            "signature": '{$pkg.signature}'
        },
        hide:1
    });
</script>
</html>